import triton
import triton.language as tl
import torch
import torch_npu
from .util import triton_helper_compile, compiled_kernel_list

@triton.jit
def fused_kernel3(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 18432
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x0 = xindex % 9
    x1 = (xindex // 9) % 64
    x2 = (xindex // 576)
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (x1 + (64*(x2 // 4)) + (512*x0)), None, eviction_policy='evict_last')
    tmp1 = 0.3535533905932738
    tmp2 = tmp0 * tmp1
    tl.store(out_ptr0 + (x3), tmp2, None)

def test_compile_for_fused_kernel3():
    signature = {0: '*fp32', 1: '*fp32', 2: 'i32'}

    constants = {
        "XBLOCK": 2048
    }
    triton_helper_compile(func=fused_kernel3, signature=signature, constants=constants)

compiled_kernel_list["fused_kernel3"] = test_compile_for_fused_kernel3